﻿ @inherits AdminCompontentBase

<SAutoComplete Value="Value"
               ValueChanged="async value => await UpdateValueAsync(value)"
               TValue="List<Guid>"
               TItem="StaffSelectDto"
               TItemValue="Guid"
               Items="Staffs"
               Chips
               Filter="FilterItem" NoFilter
               OnSearchInputUpdate="QuerySelectionStaff"
               Loading="_staffLoading"
               Disabled=Readonly
               Label="@Label"
               ItemText="t=>t.DisplayName"
               ItemValue="t=>t.Id"
               Multiple
               Class="@Class">
    <SelectionContent Context="data">
        <MChip Close Style="height:28px;" OnCloseClick="()=>RemoveStaff(data.Item)">
            @if (!string.IsNullOrEmpty(data.Item.Avatar))
            {
                <MAvatar Left>
                    <MImage Src="@data.Item.Avatar"></MImage>
                </MAvatar>
            }
            <span class="body2 regular--text">
                @ReturnNotNullValue(data.Item.DisplayName,data.Item.Name)
            </span>
        </MChip>
    </SelectionContent>
    <ItemContent Context="data">
        @if (!string.IsNullOrEmpty(data.Item?.Avatar))
        {
            <MListItemAvatar>
                <img src="@data.Item.Avatar">
            </MListItemAvatar>
        }
        <MListItemContent>
            <MListItemTitle>
                <span class="subtitle2 emphasis2--text">
                    @data.Item?.DisplayName
                </span>
                <MDivider Vertical Class="mx-1" Style="@((!string.IsNullOrEmpty(data.Item?.DisplayName) && !string.IsNullOrEmpty(data.Item?.JobNumber))?"height:12px;":"height:0px;")" />
                <span class="caption regular2--text">
                    @data.Item?.JobNumber
                </span>
            </MListItemTitle>
            <MListItemSubtitle>
                <span class="body2 regular2--text">
                    @data.Item?.PhoneNumber
                </span>
                <MDivider Vertical Class="mx-1" Style="@((!string.IsNullOrEmpty(data.Item?.PhoneNumber) && !string.IsNullOrEmpty(data.Item?.Email))?"height:12px;":"height:0px;")" />
                <span class="body2 regular2--text">
                    @data.Item?.Email
                </span>
            </MListItemSubtitle>
        </MListItemContent>
    </ItemContent>
</SAutoComplete>
